<?php

namespace app\common\validate;

use think\Validate;

/**
 * 公共验证
 */
class Common extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'type'      => 'require|in:1,2,11,12',
        'id'        => 'require|number',
        'promotion' => 'number',

    ];

    protected $field = [
        'type'     	=> '参数',
        'id'     	=> '对象',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
    	'type.in' 		=> '参数错误',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'share_info'     	=> ['type', 'id', 'promotion'],
    ];


}
